<?php
require_once('../../libraryfiles/config.php');
$view = (isset($_GET['view'])) ? $_GET['view'] : '';
$include = '
<script type="text/javascript" src="'.W_ROOT.'/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="'.W_ROOT.'/js/function.js"></script>
<script type="text/javascript" src="'.W_ROOT.'/js/common.js"></script>';

switch ($view) {
	case 'add' :
		if(isset($_GET['id'])){
			$id=(int)$_GET['id'];
		}
		else if(isset($_POST['id'])){
			$id=$_POST['id'][0];
		}
		else $id = 0;

		$site_title = "Administrator Site - Add New Video";
		$content = 'add.php';
		break;

	case 'modify' :
		$site_title = "Administrator Site - Update Video";
		$content = 'add.php';
		break;

	case 'publish' :
		if (isset($_GET['id']) && (int)$_GET['id'] > 0) {
			$id = (int)$_GET['id'];
		} else {
			header('Location:'.base_url_admin.'/vdoyoutube/index.php');
			exit();
		}

		if(isset($_GET['publish']) && (int)$_GET['publish']>=0 && (int)$_GET['publish']<=1){
			$publish = (int)$_GET['publish'];

		}
		else {
			header('Location:'.base_url_admin.'/vdoyoutube/index.php');
			exit();
		}

		publish(Tblvdoyoutube::tblvdoyoutube,$publish,$id);
		$sql_pub = "UPDATE ".Tblvdoyoutube::tblvdoyoutube ." SET ".Tblvdoyoutube::vdo_status."=".$publish." WHERE ".Tblvdoyoutube::id."=".$id;
		mysql_query($sql_pub);
		header("Location: index.php?".getAllGetParams(array('view','id','publish')));//page=".$page."&");
		exit();
		break;

	default :
		$site_title = "Administrator | Blog"; //Set Title of our page
		$content 	= 'list.php';
		break;
}

require_once TMP_ADMIN_PATH;
?>